﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace YasharEl.Infrastructure.SoftwareModel.SOA
{
    /// <summary>
    /// Capability Services implement the business-level capabilities of the organization, 
    /// and represent the action-centric building blocks (or "atomic verbs") 
    /// that make up the organization's business processes. 
    /// A few examples of Capability Services include third-party interfacing services 
    /// such as a credit card processing service 
    /// that can be used for communication with an external payment gateway 
    /// in any composite application where payments are made by credit card, 
    /// or a value-add building block like a rating service 
    /// that can process and calculate user ratings for anything that can be rated 
    /// (usefulness of a help page, a book, a vendor, and so forth) 
    /// in any application that utilizes ratings. 
    /// 
    /// Capability Services can be further divided by the type of service that they provide 
    /// (for example, third-party interfacing or value-add building block), 
    /// but this further distinction is out of scope for this discussion.
    /// 
    /// Capability Services expose a service interface specific to the capability they represent. 
    /// In some cases, an existing (legacy) or newly acquired business capability may not comply
    /// with the organization's way of exposing capabilities as services, 
    /// or even may not expose a service interface at all. 
    /// In these cases, the capability is typically wrapped with a thin service layer 
    /// that exposes the capability's API using a service interface that adheres to the organization's way of exposing capabilities. 
    /// 
    /// For example, some credit-card processing-service companies present 
    /// an HTML-based API that requires the user to complete a Web-based form. 
    /// A capability like that would be wrapped by an in-house-created-and-managed-façade service 
    /// that will provide easy programmatic access to the capability. 
    /// The façade service is opaque and masks the actual nature of the capability that's behind it, 
    /// to the point where the underlying capability can be replaced 
    /// without changing the service interface used to access it. 
    /// Therefore, the façade service is considered to be the Capability Service, 
    /// and the underlying capability becomes merely an implementation detail of the façade service.
    /// Capability Services typically do not directly manage application state; 
    /// to make state changes in the application, they utilize Entity Services. 
    /// If a Capability Service does manage state, that state is typically transient and lasts 
    /// for a duration of time that is shorter than the time needed to complete 
    /// the business process that this Capability Service partakes in.
    /// For example, a Capability Service that provides package shipping price quotes 
    /// might record the fact that requests for quotes were sent to the shipping providers 
    /// until the responses come back, 
    /// thereafter erasing that record. 
    /// 
    /// In addition, a Capability Service that is implemented as a workflow will manage the durable,
    /// transient execution state for all the currently running instances of that workflow. 
    /// While most of the capabilities are "stateless," 
    /// there are, of course, capabilities such as event logging that naturally manage and encapsulate state.
    /// 
    /// Users of Capability Services may require that a permission be configured 
    /// for them in order to use the service, 
    /// be it at the application, user, or the application-user scope. 
    /// 
    /// Access to a Capability Service is typically granted at the application level. 
    /// Per-user permissions are typically managed by the Process Services 
    /// that make use of the Capability Services to simplify access management 
    /// and prevent midprocess access failures.
    /// 
    /// Error compensation in Capability Services is limited to 
    /// the scope of meeting the capability's Service-Level Expectation (SLE) and Service-Level Agreements (SLA). 
    /// For example, a Shipping Service that usually compares the rates 
    /// and delivery times of four vendors (FedEx, UPS, DHL, and a local in-town courier service, for example) 
    /// may compensate for a vendor's unavailability by ignoring the failure and 
    /// continuing with the comparison of the rates that it was able to secure as long as it received at least 2 quotes. 
    /// This example illustrates that compensation may result in lowered performance. 
    /// This degradation can be expressed in terms of latency, 
    /// quality of the service, and many other aspects, 
    /// and therefore it needs to be described in the SLE and SLA for the service.
    /// Capability Services may support distributed atomic transactions and/or the Reservation Pattern. 
    /// Most Capability Services do not manage resources whose state needs 
    /// to be managed using atomic transactions, 
    /// but a Capability Service may flow an atomic transaction in which it is included to the Entity Services that it uses. 
    /// Capability Services are also used to implement a Reservation Pattern over Entity Services 
    /// that do not support that pattern, 
    /// and to a much lesser extent over other Capability Services that do not support that pattern.
    /// 
    /// Capability Services can be developed and managed in-house, 
    /// purchased from a third party and managed in-house, or "leased" from an external vendor 
    /// and consumed as SaaS that is externally developed, maintained, and managed.
    /// 
    /// When developed in-house, Capability Services may be implemented using imperative code or a declarative workflow. 
    /// If implemented as a workflow, a Capability Service may be modeled as a short-running (atomic, nonepisodic) business activity. 
    /// Long-running business activities, in which things may fail or require compensation, often fall into the Process Service category.
    /// 
    /// A Capability Service is almost always used by multiple composite applications, 
    /// and is thus typically centrally managed.
    /// </summary>
    public interface ICapabilityService : IApplicationService
    {
    }
}
